package com.order.controller;

import com.cloud.domain.TbOrder;
import com.cloud.domain.TbUser;
import com.order.feign.UserClient;
import com.order.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @version 1.0
 * @author: yu.tan
 * @date: 2020/10/12 22:38
 * @Description:
 */
@RestController
public class OrderController {

    @Autowired
    private UserClient userClient;

    @Autowired
    private OrderService orderService;


    @GetMapping("/order_test")
    public String testFeign(){
        TbUser test = userClient.test();
//        if (test.getId()==-100){
//            return "调用失败";
//        }
        return test.toString();
    }

    @GetMapping("/order_cache")
    public List<TbOrder> testCache(){
        return orderService.testCache();
    }

    @GetMapping("/order_cache1")
    public TbOrder testCache1(){
        return orderService.testCache1();
    }


    @GetMapping("/order_cache2")
    public List<TbOrder> testCache2(){
        return orderService.testCache2();
    }



}
